package com.example.location.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
public class RedisController {
    @Value("${server.port}")
    String port;
    @PostMapping("/save")
    public String saveusername(String user , HttpSession session){
        session.setAttribute("user",user);
        return port;
    }

    @GetMapping("/get")
    public String getusername(HttpSession session){
        return port + ":" +session.getAttribute("user").toString();
    }
}
